//
//  UINavigationController_runtime.swift
//  AJiTai
//
//  Created by 周博 on 2020/6/11.
//  Copyright © 2020 BO ZHOU. All rights reserved.
//

import UIKit


public extension UINavigationController {
    override open class func initRunTime() {
        exchange(originalSelector: #selector(pushViewController(_:animated:)), swizzledSelector: #selector(exchange_pushViewController(_:animated:)))
    }

    // push之后隐藏tabbar
    @objc private func exchange_pushViewController(_ viewController: UIViewController, animated: Bool) {

        if self.children.count > 0 {
            viewController.hidesBottomBarWhenPushed = true
        }
        self.exchange_pushViewController(viewController, animated: animated)
    }
}
